Engine

public final static Engine Engine(RenderingMode renderingMode, Function1<OptionsDsl, Unit> configuration)
public final static Engine Engine(RenderingMode renderingMode, Function1<OptionsDsl, Unit> configuration)

Creates a new instance of Engine with the given renderingMode and configuration.

Please note, JxBrowserLicense is needed to create an engine. It can be passed implicitly with a VM option or explicitly during the instance creation. In the latter scenario, a license is passed as a part of engine's configuration.

In the simplest case, when a license is passed as a VM option, only RenderingMode is needed to create a new Engine:

import com.teamdev.jxbrowser.engine.RenderingMode.HARDWARE_ACCELERATED
// ...
val engine = Engine(HARDWARE_ACCELERATED)

The custom options can be passed with the given configuration block:

import com.teamdev.jxbrowser.engine.RenderingMode.HARDWARE_ACCELERATED
// ...
val engine = Engine(HARDWARE_ACCELERATED) {
license = JxBrowserLicense(licenseKey)
userDataDir = chooseUserDataDir()
}

EngineOptions can be created separately from the Engine itself. This allows re-using of the same options to create multiple engine instances.

An example of engine creation with a standalone options:

import com.teamdev.jxbrowser.dsl.engine.EngineOptions
// ...
val options = EngineOptions {
license = JxBrowserLicense(licenseKey)
userDataDir = chooseUserDataDir()
}
val engine = Engine(options)

Since

8.0.0


public final static Engine Engine(EngineOptions options)
public final static Engine Engine(EngineOptions options)

Creates a new instance of Engine with the given options.

Since

8.0.0